<?
class App_TicketModel extends AppModel {
    protected $tableName='ticket';
    protected $_map=array(//字符映射
        'title'=>'remark',
        'operator'=>'rewarder_name',
        'total'=>'sum(number)',
    );
    //获取奖票总数
    public function total($map){
        $check=D('ticket')->where($map)->field('sum(number)')->find();
        $data = $check?$this->parseFieldsMap($check):'';
        return $data;
    }
    //获取奖票明细
    public function detail($map){
        $check=D('ticket')->where($map)->field('number,remark,rewarder_name,time')->select();
        $data=$check?$this->parseFieldsMap($check):'';
        return $data;
    }
}